<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@page import="com.cap.bts.framework.usermgnt.constant.EmployeeStatus"%>    
    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>导出卡片</title>
<%@include file="../include/include.jsp"%>
<link rel="stylesheet" type="text/css" href="${csspath }/public.css"/>
<link rel="stylesheet" type="text/css" href="${csspath }/datepicker.css"/>
<link rel="stylesheet" type="text/css" href="${csspath }/style_l.css"/>
<script type="text/javascript" src="${jspath }/jquery-1.4.4.js"></script>
<script type="text/javascript" src="${jspath }/jquery.ui.min.js"></script>
<script type="text/javascript" src="${jspath }/ui.datepicker_zh-CN.js"></script>
<script type="text/javascript" src="${jspath }/jquery.blockUI.js"></script>
<script type="text/javascript" src="${jspath }/public.js"></script>
<script type="text/javascript" src="${jspath }/jquery.selectAll.js"></script>
<script type="text/javascript" src="${jspath}/jquery/jquery.ui.draggable.js"></script>
<script type="text/javascript" src="${jspath}/jquery/jquery.alerts.js"></script>
<script type="text/javascript" src="${jspath}/load_layer.js"></script>
<link rel="stylesheet" type="text/css" href="${csspath}/jquery.alerts.css" />

	<script type="text/javascript"
	src="${webcontext}/javascript/jquery/jquery.ui.draggable.js"></script>
	<link rel="stylesheet" type="text/css"
	href="${bootstrapPath}/css/bootstrap.css" />
<script type="text/javascript" src="${bootstrapPath}/js/bootstrap.js"></script>
<script type="text/javascript">
function search() {
	search_form.action="${webcontext}/crmdp/dealer/card/toExportCard";
	document.getElementById("search_form").submit();
}
function exportCard(id){
	if($("#lastExportId")!=''){
		$("input[name='exportList["+$("#lastExportId").val()+"].isExport']").val(0);
	}
	$("#lastExportId").val(id);
	$("input[name='exportList["+id+"].isExport']").val(1);
	document.getElementById("search_form").submit();
}
</script> 
</head>
<body>
	<div id="content">
		    <div class="spliter h_5"></div>
			<div class="page_info"></div>
			<div class="spliter h_5"></div>
		<div id="wrap">
	<form:form id="search_form" class="form-horizontal" action="${webcontext}/crmdp/dealer/card/exportCard" method="post" modelAttribute="dto">
					 <div class="">
						<div class="spliter h_10"></div>
							<div class="form-group">
								<label class="col-sm-2 control-label" for="startDate">生成日期：</label>
								<fmt:formatDate value="${dto.queryDto.startDate}" pattern="yyyy-MM-dd HH:mm:ss" var="startDate"/>
								<fmt:formatDate value="${dto.queryDto.endDate}" pattern="yyyy-MM-dd HH:mm:ss" var="endDate"/>
								<div class="col-sm-2">
									<input type="text" name="queryDto.startDate"  class="form-control input-sm input-sm validate[length[0,100]] date" value="${fn:substring(startDate, 0, 10)}"/>
								</div>
							 	<label class="col-sm-1 control-label" style="width: 45px;">至</label>
							 	<div class="col-sm-2">
							 		<input type="text" class="form-control input-sm input-sm validate[length[0,100]] date" name="queryDto.endDate" value="${fn:substring(endDate, 0, 10)}"/>
							 	</div> 
							 	<label class="col-sm-2 control-label" for="startDate">卡片名:</label>
							 	<div class="col-sm-2"><input type="text" name="queryDto.name" class="form-control input-sm" value="${dto.queryDto.name}"/>
								</div>
							 </div>
						<div style="text-align: center; margin-top: 10px;">
							<button type="button" class="btn btn-success" onclick="search()"><i class="glyphicon glyphicon-search" style="color:#FFFFFF"></i>&nbsp;查询</button>
							<button type="reset" class="btn btn-success"><i class="glyphicon glyphicon-trash" style="color:#FFFFFF"></i>&nbsp;重置</button>
						</div>
						<div class="spliter h_10"></div>
					</div>
	
			<div class="spliter h_5"></div>
			<div class="page_info"></div>
			<div class="spliter h_10"></div>
			<div id="dataTable" class="data_div">
			  <table id="table" class="table">
				<tr>
					<th width="15%">卡片名称</th>
					<th width="5%">数量</th>
					<th width="15%">起始卡号</th>
					<th width="15%">终止卡号</th>
					<th width="15%">生成日期</th>
					<th width="7%">是否导出</th>
				</tr>
            	<core:forEach items="${cardGenerationList}" var="list" varStatus="status">
            		<input type="hidden" name="exportList[${status.index}].id" value="${list.id}">
            		<input type="hidden" id="lastExportId" value="">
              		<tr>
						<td class="align_m"><input type="hidden" name="exportList[${status.index}].name" value="${list.cardDefinition.name}">${list.cardDefinition.name}</td>
						<td class="text-right"><input type="hidden" name="exportList[${status.index}].quantity" value="${list.quantity}">${list.quantity}</td>
						<td class="align_m"><input type="hidden" name="exportList[${status.index}].cardNumFrom" value="${list.cardNumFrom}">${list.cardNumFrom}</td>
						<td class="align_m"><input type="hidden" name="exportList[${status.index}].cardNumTo" value="${list.cardNumTo}">${list.cardNumTo}</td>
						<fmt:formatDate value="${list.createDate}" pattern="yyyy-MM-dd HH:mm:ss" var="createDate"/>
						<td class="align_m">${fn:substring(createDate, 0, 10)}</td>
						<td class="align_m"><input type="hidden"  name="exportList[${status.index}].isExport" value="0"><button type="button" class="btn btn-success btn-xs btnLength" style="width:50px;"  onClick="exportCard('${status.index}')">
						<!-- <i class="glyphicon glyphicon-open" style="color:#FFFFFF"></i> -->导出</button></td>
<%-- 						<td class="align_m"><input id="chk_createCard${list.id}" name="exportList[${status.index}].isExport" type="checkbox" ></td> --%>
					</tr>
                </core:forEach>
			</table>
		</div>
			<div class="page_div">
			    <%@include file="../common/page.jsp"%>
			</div> 
		<!-- 	<div class="btn_div">
                <button type="submit" class="btn" style="width: 100px; value="导出卡号"><i class="glyphicon glyphicon-open" style="color:#FFFFFF"></i>&nbsp;导出卡号</button>
            </div> -->
		</form:form>
		</div>
		<!-- /wrap -->
		</div>
	<!-- /content -->
	</body>
	</html>